package jtk.project4.fleet.field;

import jtk.project4.fleet.domain.Customers;
import jtk.project4.fleet.domain.Equipment;
import jtk.project4.fleet.domain.Vendor;

import nl.coderight.jazz.form.FormLayout;
import nl.coderight.jazz.form.control.GroupControl;
import nl.coderight.jazz.form.field.ComboField;
import nl.coderight.jazz.form.field.MemoField;
import nl.coderight.jazz.form.field.TextField;

public class AddCustomerField extends GroupControl<Customers> {
	private TextField nameField;
	private TextField contactField;
	private TextField address1Field;
	private TextField address2Field;
	private TextField cityField;
	private TextField stateField;
	private TextField zipField;
	private TextField countryField;
	private TextField phone1Field;
	private TextField phone2Field;
	private TextField faxField;
	private TextField emailField;
	private ComboField typeField;
	private ComboField termsField;
	private TextField websiteField;
	private MemoField commentsField;
	
	public AddCustomerField(String bindID) {
		//setTitle("Equipment Selection");
		//setTitle("header.SpecifyAdditionalFilterCriteria");
		setBindID(bindID);
		createFields();
		createLayout();
	}
	
		
	private void createFields() {
		nameField = new TextField("name", 25);
		contactField = new TextField("contact",15);
		address1Field = new TextField("address1",25);
		address2Field = new TextField("address2",25);
		cityField = new TextField("city",15);
		stateField = new TextField("state",15);
		zipField = new TextField("zip",5);
		countryField = new TextField("country",10);
		phone1Field = new TextField("phone1",15);
		phone2Field = new TextField("phone2",15);
		faxField = new TextField("fax",15);
		emailField = new TextField("email",20);
		typeField = new ComboField("Vendor","type");
		typeField.setPreferredSize(nameField.getPreferredSize());
		termsField = new ComboField("Vendor","terms");
		termsField.setPreferredSize(nameField.getPreferredSize());
		websiteField = new TextField("website",20);
		commentsField = new MemoField("comments");
		commentsField.setRows(2);
		
		//fieldField = new ComboField("equipments", "field");
		//conditionField = new ComboField("equipments", "condition");
		//valueField = new TextField("value", 20);
	}
	

	private void createLayout() {
		setLayout(new FormLayout())
		.addLabel("Name")		.addField(nameField)
		.addRow()
		.addLabel("Contact") 	.addField(contactField)
		.addRow()
		.addLabel("Address#1") 	.addField(address1Field)
		.addRow()
		.addLabel("Address#2") 	.addField(address2Field)
		.addRow()
		//.addLabel("Address#1") 	.addField(address1Field)
		//.addRow()
		.addLabel("City") 		.addField(cityField)
		.addRow()
		.addLabel("State/Prov") .addField(stateField)
		.addRow()
		.addLabel("Postal Code") .addField(zipField)
		.addRow()
		.addLabel("Country") 	.addField(countryField)
		.addRow()
		.addLabel("Phone#1") 	.addField(phone1Field)
		.addRow()
		.addLabel("Phone#2") 	.addField(phone2Field)
		.addRow()
		.addLabel("Fax") 	.addField(faxField)
		.addRow()
		.addLabel("E-mail") 	.addField(emailField)
		.addRow()
		.addLabel("Type") 	.addField(typeField)
		.addRow()
		.addLabel("terms") 	.addField(termsField)
		.addRow()
		.addLabel("Website") 	.addField(websiteField)
		.addRow()
		.addLabel("Comments") 	.addField(commentsField)
		.addRow()
		;
		
	}
}